#ifndef __DYNAMICARRAY_H_
#define __DYNAMICARRAY_H_
#include <stdbool.h>

#define ElementType void*
#define INITDARRAY(a) DArray a;InitDynamicArray(&a);
struct DynamicArray;
typedef struct DynamicArray DArray;
struct DynamicArray
{
    ElementType *dp; //动态数组指针
    int size;   //容量
    int len;    //长度


    bool (*InsertArrayTail)(DArray *a,ElementType element);
    bool (*RemoveByElement)(DArray *a,ElementType element,bool (*funcPtr)(ElementType,ElementType),void (*ClearPtr)(ElementType));
    DArray (*FindElement)(DArray *a,ElementType element,bool (*funcPtr)(ElementType,ElementType));
    void (*DisplayDynamicArray)(DArray *a,void (*funcPtr)(ElementType));
    void (*Sort)(DArray *a,bool (*funcPtr)(ElementType,ElementType));
    void (*ClearDynamicArray)(DArray *a,void (*funcPtr)(ElementType));
};

void InitDynamicArray(DArray *a);

#endif